package com.smart.smartdata;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AddTestDialog extends AbDialogFragment {
    @Bind(R.id.et_name)
    EditText etName;
    @Bind(R.id.et_six)
    EditText etSix;
    @Bind(R.id.et_weight)
    EditText etWeight;
    @Bind(R.id.et_age)
    EditText etAge;
    @Bind(R.id.et_height)
    EditText etHeight;
    @Bind(R.id.tv_start)
    TextView tvStart;

    @Override
    protected int getLayoutId() {
        return R.layout.add_test_dialog;
    }

    @Override
    protected void initData(View view) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick(R.id.tv_start)
    public void onViewClicked() {
        MessageData messageData = new MessageData();
        messageData.name = etName.getText().toString().trim();
        messageData.six = etSix.getText().toString().trim();
        messageData.wight = etWeight.getText().toString().trim();
        messageData.age = etAge.getText().toString().trim();
        messageData.height = etHeight.getText().toString().trim();

        Bundle bundle = new Bundle();
        bundle.putSerializable("messageData",messageData);


        AppUtils.jump(getActivity(),RecordedDataActivity.class,bundle);

        dismiss();

    }


}
